package cst.a728hyl.zyfypt_728hyl.Fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

import cst.a728hyl.zyfypt_728hyl.Adapter.TcaseAdapter;
import cst.a728hyl.zyfypt_728hyl.Adapter.VideoAdapter;
import cst.a728hyl.zyfypt_728hyl.Bean.TcaseBean;
import cst.a728hyl.zyfypt_728hyl.Bean.VideoBean;
import cst.a728hyl.zyfypt_728hyl.R;
import cst.a728hyl.zyfypt_728hyl.ResModel;
import cst.a728hyl.zyfypt_728hyl.hylListener;

/**
 * Created by Neusoft on 2017/4/9.
 */

public class Tcase_CaseFragment extends Fragment {
    private RecyclerView recyclerView;
    private TcaseAdapter adapter;
    private List<TcaseBean> list;
    private RecyclerView.LayoutManager layoutManager;
    private hylListener<List<TcaseBean>> listener;
    private ResModel model;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_tcase_case, container, false);
        recyclerView = (RecyclerView) view.findViewById(R.id.tcase_rec);
        adapter = new TcaseAdapter(getActivity());
        list = new ArrayList<TcaseBean>();
        layoutManager = new LinearLayoutManager(getActivity());
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setAdapter(adapter);
        listener = new hylListener<List<TcaseBean>>() {
            @Override
            public void onResponse(List<TcaseBean> l) {
                adapter.setList(l);
            }

            @Override
            public void onFail(String msg) {

            }
        };
        model = new ResModel("gson");
        model.getList("tcase", 1, listener);
        return view;
    }
}
